home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / XLisp-Stat / Test / Bayescomp.lsp next >
Lisp/Scheme  |  1990-10-11  |  722b  |  24 lines

  1. ; tech report pp. 61-65
  2.  
  3. (require "data/leukemia")
  4.  
  5. (def transformed-wbc-pos (- (log wbc-pos) (log 10000)))
  6. (defun llik-pos (theta)
  7.   (let* ((x transformed-wbc-pos)
  8.          (y times-pos)
  9.          (theta0 (select theta 0))
  10.          (theta1 (select theta 1))
  11.          (tix (* theta1 x)))
  12.     (- (sum tix)
  13.        (* (length x) (log theta0))
  14.        (/ (sum (* y (exp tix)))
  15.           theta0))))
  16. (def lk (bayes-model #'llik-pos (list (exp 3.5) .8)))
  17. ;(plot-lines (send lk :margin1 0 (rseq 30 120 30)))
  18. (defun lk-sprob (theta)
  19.   (let* ((time 52.0)
  20.          (x (log 5))
  21.          (mu (* (select theta 0) (exp (- (* (select theta 1) x))))))
  22.      (exp (- (/ time mu)))))
  23. (plot-lines (send lk :margin1 #'lk-sprob (rseq .01 .8 30)))
  24.